package com.chenjun.common.util.encoder;
/*package com.candowin.common.util.encoder;

import java.io.FileInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

import org.apache.log4j.Logger;

import com.rt.*;
import com.candowin.common.util.StringUtil;
public class Base64Encode {
	
	private Base64Encode(){}
	
	private static final Logger logger = Logger.getLogger(Base64Encode.class);
      
	     
	     * 解密
	     
	    public static String decryptBASE64(String base64Str)
	    {
	    	if(base64Str != null && !"".equals(base64Str))
	    	{
	    		byte[] bStr = null;
	    		
	    		try {  
	    			
	    			 bStr = new BASE64Decoder().decodeBuffer(base64Str);  
	                 return new String(bStr, "utf-8");  
	                 
	             } catch (Exception e) {  
	            	 logger.error(e.getMessage());
	             }  
	    	}
	    	
	    	return null;
	    }
	    
	    
	     * 加密
	     * 
	     
	    
	    public static String encryptBASE64(String base64Str)
	    {   
	    	if(base64Str != null && !base64Str.equals(""))
	    	{
	    		byte[] bStr = null;
	    		try
	    		{
	    		  bStr = base64Str.getBytes("utf-8");
	    		  
	    		}catch(UnsupportedEncodingException ex)
	    		{
	    			logger.error(ex.getMessage());
	    			return null;
	    		}
	    		
	    		return new BASE64Encoder().encode(bStr);
	    	}
	    	
	    	return null;
	    }
	    
	   public static String encryptBASE64(byte [] buffer)
	   {
		   return new BASE64Encoder().encode(buffer); 
	   }
	   
	   public static String ByteC2Java(String strFinger)
	   {
		   String [] strBuffer = strFinger.split("\\|");
		   byte[] buffer = new byte[strBuffer.length];
		   for(int index = 0; index<strBuffer.length; index++)
		   {
			   buffer[index] = Byte.parseByte(strBuffer[index]);
		   }
		   
		   return encryptBASE64(buffer);
	   }
	   
	   public static byte[] ByteC2JavaBuffer(String faceBuffer)
	   {
		   String [] strBuffer = faceBuffer.split("\\|");
		   byte[] buffer = new byte[strBuffer.length];
		   for(int index = 0; index<strBuffer.length; index++)
		   {
			   buffer[index] = Byte.parseByte(strBuffer[index]);
		   }
		   
		   return buffer;
	   }
	   
	   public static byte[] ImgStr2Byte(String imgStr)
	   { 
          try{
        	  
        	  if(!StringUtil.dealNull(imgStr).equals(""))
    		  {  
    			  BASE64Decoder decoder = new BASE64Decoder();  
    			  byte[] bytes = decoder.decodeBuffer(imgStr);  
    			  for(int index = 0; index < bytes.length; index++)
    			  {
    				  if(bytes[index] < 0)
    				  {
    					bytes[index] += 256;  
    				  }
    			  }
    			  
    			  return bytes;
    		  }
        	  
          }catch(Exception ex)
          {
        	  logger.error(ex.getMessage());
          }
		  
		  return null;
	   }
	   
	   public static String Byte2ImgStr(String filePath)
	   {
		   byte[] bytes = null;
		   try{
			   
			 InputStream in = new FileInputStream(filePath);  
			 bytes = new byte[in.available()];  
		     in.read(bytes);  
			 in.close();  
			 BASE64Encoder encoder = new BASE64Encoder();  
			 return encoder.encode(bytes);  
  
		   }catch(Exception ex){ 
			   logger.error(ex.getMessage());
		   }
		   return null;   
	   }
}
*/